function GUIHandler() {
	this._editFormHTML = "<input type='hidden' id='idInput' value='0' />"+
						"<table>"+
						"<tr><th>Fornavn:</th><td><input id='fNavnInput' /></td></tr>"+
						"<tr><th>Etternavn:</th><td><input id='eNavnInput' /></td></tr>"+
						"<tr><th>Adresse:</th><td><input id='adresseInput' /></td></tr>"+
						"<tr><th>Telefon:</th><td><input id='tlfInput' /></td></tr>"+
						"</table>"+
						"<input type='button' onclick='jsMain.saveMember()' value='Ferdig' />";
	this._newMemberButtonHTML = "<input type='button' onclick='jsMain.newMember()' value='Nytt medlem'>";
};
GUIHandler.prototype.updateTable = function(data) {
	this._removeMembers(data.slettedeMedlemmer);
	this._updateMembers(data.endredeMedlemmer);
	this._addMembers(data.nyeMedlemmer);
};
GUIHandler.prototype.restoreNewMemberButton = function() {
	$("#memberEdit").html(this._newMemberButtonHTML);
};
GUIHandler.prototype.showMemberEdit = function(id) {
	$("#memberEdit").html(this._editFormHTML);
	if (id) { 
		$("#idInput").val(id);
		$("#fNavnInput").val($($(".fnavnTD", "#"+id).get(0)).text());
		$("#eNavnInput").val($($(".enavnTD", "#"+id).get(0)).text());
		$("#adresseInput").val($($(".adresseTD", "#"+id).get(0)).text());
		$("#tlfInput").val($($(".telefonTD", "#"+id).get(0)).text());
	}
	
};
GUIHandler.prototype._addMembers = function(data) {
	$.each(data, function(index, value){
		$("#liste").append("<tr id="+value.medlemId+"><td class='fnavnTD'>" + value.fornavn + "</td><td class='enavnTD'>" + value.etternavn + "</td>"+
							"<td class='adresseTD'>"+value.adresse+"</td><td class='telefonTD'>"+value.telefon+"</td>"+
							"<td><button type='button' onclick='jsMain.deleteMember(event)'>Slett</button>"+
							"<td><button type='button' onclick='jsMain.editMember(event)'>Endre</button></td></tr>");
	});
};
GUIHandler.prototype._updateMembers = function(data) {
	$.each(data, function(index, value){
		$("#"+value.medlemId).replaceWith("<tr id="+value.medlemId+"><td class='fnavnTD'>" + value.fornavn + "</td><td class='enavnTD'>" + value.etternavn + "</td>"+
							"<td class='adresseTD'>"+value.adresse+"</td><td class='telefonTD'>"+value.telefon+"</td>"+
							"<td><button type='button' onclick='jsMain.deleteMember(event)'>Slett</button>"+
							"<td><button type='button' onclick='jsMain.editMember(event)'>Endre</button></td></tr>");
	});
};
GUIHandler.prototype._removeMembers = function(data) {
	$.each(data, function(index, value){
		$("#"+value).remove();
	});
};